package com.platform.api.bzproject.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.platform.api.bzproject.model.BzAllWallpaper;
import com.platform.api.bzproject.model.WalletDetails;
import com.platform.api.bzproject.dao.WalletDetailsMapper;
import com.platform.api.bzproject.service.IWalletDetailsService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.platform.common.core.Constant;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 钱包明细 服务实现类
 * </p>
 *
 * @author guoshao
 * @since 2022-01-02
 */
@Service
public class WalletDetailsServiceImpl extends ServiceImpl<WalletDetailsMapper, WalletDetails> implements IWalletDetailsService {


    @Autowired
    private WalletDetailsMapper walletDetailsMapper;

    @Override
    public PageInfo<WalletDetails> selectWalletDetails(WalletDetails walletDetails, Integer offset) {
        Integer pageNum = 1;
        if(offset > 0){
            pageNum = (offset / Constant.PAGESIZE) + 1;
        }
        PageHelper.startPage(pageNum, Constant.PAGESIZE);

        final PageInfo<WalletDetails> userPageInfo = new PageInfo<>(walletDetailsMapper.selectWalletDetails(walletDetails));
        return userPageInfo;
    }
}
